package wms2010.gui.forms;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.GridLayout;

import javax.swing.JButton;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

import org.springframework.stereotype.Component;

public abstract class SimpleForm extends JInternalFrame {
	
	private JPanel rootOfTextBox = new JPanel();
	private JPanel buttonsToEast = new JPanel();
	private JPanel containerButtons = new JPanel();

	protected JPanel textFields = new JPanel();
	protected JPanel labels = new JPanel();
	protected JButton okButton = new JButton("OK");
	protected JButton cancelButton = new JButton("Cancel");
	protected JPanel center = new JPanel();
	
	public SimpleForm() {
		this.rootOfTextBox.setLayout(new BorderLayout());
		
		this.center.setLayout(new BorderLayout());
		this.add(rootOfTextBox, BorderLayout.NORTH);
		this.add(center);
		
		this.labels.setLayout(new GridLayout(0, 1));
		this.textFields.setLayout(new GridLayout(0, 1));

		this.containerButtons.setLayout(new FlowLayout());
		this.containerButtons.add(okButton);
		this.containerButtons.add(cancelButton);

		this.rootOfTextBox.add(labels, BorderLayout.WEST);
		this.rootOfTextBox.add(textFields, BorderLayout.CENTER);

		this.buttonsToEast.setLayout(new BorderLayout());
		this.buttonsToEast.add(containerButtons, BorderLayout.EAST);

		this.add(buttonsToEast, BorderLayout.SOUTH);
		
		this.setBounds(25, 25, 600, 400);
		this.setResizable(true);
		this.setDefaultCloseOperation(HIDE_ON_CLOSE);
		this.setClosable(true);
		this.setMaximizable(true);
	}
}
